<?php
namespace BP\En;
require_once("java/util/Hashtable.php");
require_once("org/omg/CORBA/TypeCode.php");
require_once("BP/DA/DataColumn.php");
require_once("BP/DA/DataRow.php");
require_once("BP/DA/DataTable.php");
require_once("BP/Tools/StringHelper.php");
class Row extends Hashtable {
	protected static $serialVersionUID;	// long
	public static function __staticinit() { // static class members
		self::$serialVersionUID = 1;
	}
	public function LoadAttrs ($attrs) // [Attrs attrs]
	{
		$this->clear();
		foreach ($attrs as $attr) 		{
			switch ($attr->getMyDataType()) {
				caseDataType->AppInt:
					$this->put($attr->getKey(), $Integer->parseInt($attr->getDefaultVal()));
					break;
				caseDataType->AppFloat:
				caseDataType->AppMoney:
					$this->put($attr->getKey(), $Float->parseFloat($attr->getDefaultVal()));
				caseDataType->AppDouble:
					$this->put($attr->getKey(), $Double->parseDouble($attr->getDefaultVal()));
					break;
				default:
					$this->put($attr->getKey(), $attr->getDefaultVal());
					break;
			}
		}
	}
	public function LoadDataTable ($dt, $dr) // [DataTable dt, DataRow dr]
	{
		$this->clear();
		foreach ($dt->Columns as $dc) 		{
			if ($dr->containsKey($dc->ColumnName))
				$this->put($dc->ColumnName, $dr->getValue($dc->ColumnName));
		}
	}
	public function SetValByKey ($key, $val) // [String key, Object val]
	{
		if (($key . NULL))
			return ;
		if ((($val == NULL) || $val->equals("")))
		{
			$this->put($key, "");
			return ;
		}
		if (($val->getClass() == TypeCode))
		{
			$this->put($key, ($val)->intValue());
		}
		else
		{
			$this->put($key, $val);
		}
	}
	public function SetValByKey_2017 ($key, $val) // [String key, Object val]
	{
		if (($key . NULL))
			return ;
		if ((($val == NULL) || $val->equals("")))
		{
			$this->put($key, "");
			return ;
		}
		if (($val->getClass() == TypeCode))
		{
			$this->put($key, ($val)->intValue());
		}
		else
		{
			$this->put($key, $val);
		}
	}
	public function GetBoolenByKey ($key) // [String key]
	{
		$obj = $this->get($key);
		if (($obj == NULL) || $obj == '' || $obj == "0")
		{
			return  FALSE ;
		}
		return  TRUE ;
	}
	public function GetValByKey ($key) // [String key]
	{
		return $this->get($key);
	}
}
Row::__staticinit(); // initialize static vars for this class on load
?>
